package cn.edu.cdu.health.entity;

import lombok.Data;
import java.io.Serializable;
import java.util.List;

@Data
public class PageResult<T> implements Serializable {
    private List<T> records;
    private Long total;
    private Long current;
    private Long size;
    private Long pages;

    // 无参构造
    public PageResult() {}

    // 有参构造
    public PageResult(List<T> records, Long total, Long size, Long current) {
        this.records = records;
        this.total = total;
        this.size = size;
        this.current = current;
        this.pages = (long) Math.ceil((double) total / size);
    }
}